<template>
  <div class="app-container">
    <div class="title-btns">
      <span class="role-span"><span></span>业务日志</span>

    </div>

    <!--表格渲染-->
    <!-- <el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
      <el-table-column prop="timestamp" label="日志时间">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.timestamp) }}</span>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="id" label="当前跟踪号" />
      <el-table-column :show-overflow-tooltip="true" prop="message" label="日志信息" />
      <el-table-column prop="logLevel" label="日志级别" />
      <el-table-column prop="appName" label="应用名" />
      <el-table-column prop="serverIp" label="服务ip" />
      <el-table-column prop="serverPort" label="服务端口" />
      <el-table-column :show-overflow-tooltip="true" prop="threadName" label="线程名" />
      <el-table-column :show-overflow-tooltip="true" prop="classname" label="类名" />
    </el-table> -->
    <div class="head-container">
      <eHeader :query="query" :dicts="dicts" />
      <el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
        <el-table-column prop="username" label="操作人" />
        <el-table-column :show-overflow-tooltip="true" prop="module" width="500px;" label="接口" />
        <el-table-column prop="params" label="参数" />
        <el-table-column prop="remoteaddr" label="ip地址" />
        <el-table-column prop="createTime" label="操作时间">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="状态" align="center">
          <template slot-scope="scope">
            <div v-for="item in flags" :key="item.value">
              <template v-if="scope.row.flag.toString() === item.value" :type="scope.row.flag ? '' : 'info'">{{ item.label }}</template>
            </div>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remark" label="异常信息" />
      </el-table>
      <!--分页组件-->
      <el-pagination
        :total="total"
        :current-page="page"
        style="margin-top: 8px;"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="sizeChange"
        @current-change="pageChange"
      />
    </div>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import initDict from '@/mixins/initDict'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
export default {
  components: { eHeader },
  mixins: [initData, initDict],
  data() {
    return {
      delLoading: false, sup_this: this,
      flags: [
        { value: '0', label: '成功' },
        { value: '1', label: '失败' }
      ]
    }
  },
  created() {
    this.$nextTick(() => {
      this.init()
      // 加载数据字典
      this.getDict('remove_status')
    })
  },
  methods: {
    parseTime,
    checkPermission,
    beforeInit() {
      this.url = 'system/syslog'
      this.params = { page: this.page, size: this.size }
      const query = this.query
      if (query.type && query.value) {
        this.params[query.type] = query.value
      }
      if (query.flag) {
        this.params['flag'] = query.flag
      }
      return true
    }
  }
}
</script>

<style scoped>

</style>
